package com.hu.ta.assignment5.beans;

public class AnnotatedToken {
	public AnnotatedToken(String tok, String pos) {
		this.token = tok;
		this.pos = pos;
	}

	private String token;
	private String pos;

	public String getToken() {
		return this.token;
	}

	public String getPos() {
		return this.pos;
	}

	public boolean isEOS() {
		return pos.trim().equals(".");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return String.format("%s/%s", token, pos);
	}

	private static int numErrors;

	@Override
	public boolean equals(Object obj) {
		AnnotatedToken tok = (AnnotatedToken) obj;
		if (!this.token.equals(tok.token)) {
			System.out.println("Error " + numErrors++ + " in eval: token "
					+ this.token + " does not equal to token " + tok.token + " (tag: " + this.pos + "=" + tok.pos);
		}
		return this.pos.equals(tok.pos);
	}

}
